<?php


namespace App\Http\Controllers;

use EasyWeChat\Factory;

class TestController extends Controller
{
    public function index()
    {
        $id = 1;
        $app = Factory::miniProgram(config('wechat'));
        $response = $app->app_code->get('home/home?forwarder_follow=' . $id);
        $filename = $id . '.png';
        if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
            $response->save('../storage/app/public/qrcode', $filename);
        }
        return env('APP_URL') . '/storage/qrcode/' . $filename;
    }
}
